package com.aaa.jvmtest.dui;

/**
 * 内存诊断
 *
 * @author Tu
 * @date 2022/5/12 17:02
 */
public class DuiNeiCunZhenduan {

    public static void main(String[] args) throws InterruptedException {
        //1: 创建对象，监测内存
        System.out.println("1.......");
        Thread.sleep(30000);
        //1024kb * 1024 = 1M 10m
        byte[] array = new byte[1024 * 1021 * 10];
        //2: 清空对象，显示调用GC
        System.out.println("2.....");
        Thread.sleep(30000);
        array = null;
        System.gc();
        //3: 再次监测内存
        System.out.println("3......");
        Thread.sleep(1000000L);
    }

}
